import {base64ToFile} from "@/utils/convertBase64ToFile.js";
import {convertFileToUrl} from "@/utils/convertFileToUrl.js";

export class ImgStyleTrans {
    constructor(imageBase64) {
        this.imageBase64 = imageBase64
        this.imageFile = ''
        this.imageUrl = ''
    }

    async parseJson(res) {
        const data = JSON.parse(res.data.data)

        this.imageBase64 = data.image   //这里是Base64编码

        console.log(this.imageBase64)

        console.log("转换成文件")
        this.imageFile = await base64ToFile(this.imageBase64, "image/png'")


        console.log(this.imageFile)

        //在vue组件中转换成链接否则这里转换返回的是一个promise对象

    }

}